package com.baizhi.service.impl;

import com.baizhi.dao.UserDAO;
import com.baizhi.entity.User;
import com.baizhi.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private UserDAO userdao;

    @Override
    public User getUser(String id) {
        /*调用第三方服务
            String address = "http://www.webxml.com.cn/WebServices/IpAddressSearchWebService.asmx?wsdl";
            JaxWsProxyFactoryBean factoryBean = new JaxWsProxyFactoryBean();
            factoryBean.setAddress(address);      // 设置代理地址
            factoryBean.setServiceClass(IpAddressSearchWebServiceSoap.class);    // 设置接口类型
            IpAddressSearchWebServiceSoap userWebService = (IpAddressSearchWebServiceSoap) factoryBean.create();// 创建一个代理接口实现
            ArrayOfString geoIPContext = userWebService.getGeoIPContext();
            System.out.println(geoIPContext);
        */
        return userdao.getUser(id);
    }

    @Override
    public void insert(User user) {
        userdao.insert(user);
    }

    @Override
    public List<User> findAll() {
        return userdao.findAll();
    }

}
